package com.example.utils;
import java.util.Random;

public class RandomObject {
    private Integer id;
    private String name;

    public RandomObject() {
        this.id = generateRandomId();
        this.name = generateRandomName();
    }

    public Integer generateRandomId() {
        Random random = new Random();
        return random.nextInt(90);
    }

    public String generateRandomName() {
        int leftLimit = 97; // 字母 'a'
        int rightLimit = 122; // 字母 'z'
        int targetStringLength = 4;
        Random random = new Random();

        return random.ints(leftLimit, rightLimit + 1)
                .limit(targetStringLength)
                .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
                .toString();
    }

    public Integer getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public static void main(String[] args) {
        RandomObject obj = new RandomObject();
        System.out.println("ID: " + obj.getId());
        System.out.println("Name: " + obj.getName());
    }
}
